import { getDictionaryList } from '@/api/system/dictionary';

export type ModuleTreeItem = {
  id?: Number;
  title?: string;
  key?: string;
  children?: any;
};

async function getTreeDataList() {
  const { items } = await getDictionaryList({ parent_id: 33 });
  const treeData: TreeItem[] = [];
  items.forEach((item) => {
    treeData.push({
      id: Number(item.id),
      title: item.name,
      key: item.id,
      children: [],
    });
  });

  return treeData;
}

export const getTreeData = () => {
  const data = getTreeDataList();
  return data;
};
